<template>
    <a-modal
            :title="title"
            :width="width"
            :visible="visible"
            switchFullscreen
            @cancel="handleCancel"
            class="printData"
    >
        <!--<div style="text-align: right;margin-bottom:10px;" >-->
            <!--<a-button type="primary" icon="printer" v-print="'#printTableList'">打印</a-button>-->
            <!--<a-button type="primary" icon="download" @click="openExcel" style="margin-left: 10px;">-->
                <!--导出Excel-->
            <!--</a-button>-->
        <!--</div>-->
        <template slot="footer">
            <a-button key="back" @click="handleCancel">
                关闭
            </a-button>
        </template>
        <div>
            <a-table
                    ref="table"
                    size="middle"
                    bordered
                    rowKey="id"
                    :columns="columns"
                    :dataSource="dataSource"
                    :pagination="ipagination"
                    :loading="loading"
                    class="j-table-force-nowrap"
                    @change="handleTableChange"
            >
                <template slot="htmlSlot" slot-scope="text">
                    <div v-html="text"></div>
                </template>
            </a-table>
        </div>

    </a-modal>
</template>

<script>
    /**
     * create by Yang
     */
    import '@/assets/less/TableExpand.less'
    import { JeecgListMixin } from '@/mixins/JeecgListMixin'

    export default {
        mixins: [JeecgListMixin],
        data() {
            return {
                title: '收运详情',
                width: '80%',
                visible: false,
                // 表头
                columns: [],
                url: {
                    list : null, // 小董接口
                },
            }
        },
        methods: {
            async show(info,params) {
                if (info && info.customerId) {
                    this.url.list = 'hc/hcRecycleRecord/getBagcodeByCustomer';
                    this.visible = true;
                    this.queryParam.customerNumber = info.customerId;
                    this.queryParam.creatTimeBegin = params.creatTimeBegin;
                    this.queryParam.creatTimeEnd = params.creatTimeEnd;
                    this.queryParam.wasteId = params.wasteId;
                    // 把医院名字添加到标题
                    if (info.customerName) {
                        this.title = `【${info.customerName}】收运详情`
                    } else {
                        this.title = '收运详情'
                    }
                    this.setColumns();
                    this.loadData(1)
                }
            },
            // 设置表格头部信息
            setColumns() {
                this.columns = [
                    {
                        title: '序号',
                        dataIndex: 'id',
                        key: 'rowIndex',
                        width: 60,
                        align: 'center',
                        customRender: (text, row, index) => {
                            return parseInt(index) + 1
                        }
                    },
                    {
                        title: '机构名称',
                        align: 'center',
                        dataIndex: 'customerName',
                        key: 'customerName',
                    },
                    {
                        title: '废物编码',
                        align: 'center',
                        dataIndex: 'recycleBagCode',
                        key: 'recycleBagCode',
                    },
                    {
                        title: '废物名称',
                        align: 'center',
                        dataIndex: 'wasteName',
                        key: 'wasteName',
                    },
                    {
                        title: '废物量(kg)',
                        align: 'center',
                        dataIndex: 'wasteOriginalValue',
                        key: 'wasteOriginalValue',
                    },
                    {
                        title: '提交人',
                        align: 'center',
                        dataIndex: 'submitUserName',
                        key: 'submitUserName',
                    },
                    {
                        title: '提交时间',
                        align: 'center',
                        dataIndex: 'createTime',
                        key: 'createTime',
                    },
                    {
                        title: '收运人',
                        align: 'center',
                        dataIndex: 'recyclePersonName',
                        key: 'recyclePersonName',
                    },
                    {
                        title: '收运时间',
                        align: 'center',
                        dataIndex: 'recycleTime',
                        key: 'recycleTime',
                    },
                ]
            },
            close() {
                this.$emit('close')
                this.visible = false
                this.dataSource = []
            },
            handleOk() {
                this.close()
            },
            handleCancel() {
                this.close()
            },
            handleEdit() {

            }
        }
    }
</script>
<style scoped>
    @import '~@assets/less/common.less';
</style>
